@extends('layouts.admin')
@section('title') @parent 商品管理 @stop
@section('page_title')@parent
商品管理
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('product-category-index') }}
@show
@section('content')
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title">商品列表</h3>
                <button class="btn btn-default pull-right" type="button" onclick="location.href='{{ route('admin.product.add') }}'"><i class="fa fa-plus"></i>添加商品</button>
            </div><!-- /.box-header -->
            <div class="box-body table-responsive">
                <table id="example2" class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>标题</th>
                            <th>分类</th>
                            <th>缩略图</th>
                            <th>库存</th>
                            <th>价格</th>
                            <th>推荐</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    @foreach ( $products as $row )
                        <tr>
                            <td>{{ $row->name }}</td>
                            <td>{{ $row->category->title }}</td>
                            <td><img src="{{ url($row->thumb) }}" alt="" width="30" height="30"></td>
                            <td>{{ $row->stock }}</td>
                            <td>{{ $row->price }}</td>
                            <td> @if ($row->is_recommend) 是 @else 否 @endif </td>
                            <td>{{ $row->status }}</td>
                            <td>
                            <a href="{{ route('admin.product.edit',['id'=>$row->id]) }}" class="btn btn-default">修改</a>
                            <a href="{{ route('admin.product.drop',['id'=>$row->id]) }}" onclick="return confirm('确定要删除吗？');" class="btn btn-default">删除</a>
                            </td>                            
                        </tr>
                     @endforeach  
                    </tbody>
                    
                </table>
            </div><!-- /.box-body -->
            <div class="box-footer clearfix">
		{{ $products->appends(Input::except('page'))->links() }}
            </div>
        </div><!-- /.box -->
    </div>
</div>
@stop
@section('end')
@parent
<script type="text/javascript">
$(document).ready(function() {
    $('#example2').dataTable({
        "bPaginate": true,
        "bLengthChange": false,
        "bFilter": false,
        "bSort": true,
        "bInfo": true,
        "bAutoWidth": false
    });
});
</script>
@stop